package com.yuezhu.com_volley;

import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.Response;

import java.util.HashMap;
import java.util.Map;

/**
 * 文件上传request
 * Created by wzt on 15/7/2.
 */
public class OkMultiPartStringRequest extends MultiPartStringRequest {

    /**
     * Creates a new multi-part request
     * @param url           URL to fetch the string at
     * @param listener      Listener to receive the String response
     * @param errorListener Error listener, or null to ignore errors
     */
    public OkMultiPartStringRequest(String url, Response.Listener<String> listener, Response.ErrorListener errorListener) {

        super(Request.Method.POST, url, listener, errorListener);
    }

    @Override
    public Map<String, String> getHeaders() throws AuthFailureError {
        HashMap<String, String> header = new HashMap<String, String>();
        header.put("Accept", "application/json");
//        header.put("appversion", Device.getVersionName());
        header.put("requestid", String.valueOf(this.hashCode()));

        return header;
    }

    /**
     * 获取RequestId
     * @return
     */
    public String getRequestId() {

        return String.valueOf(this.hashCode());
    }
}
